home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
hardware
/
test.exe
/
TESTR.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-03-29
|
2KB
|
67 lines
Program TestR; { 1993 NewsMaker Systems. Freeware }
Uses Dos,Crt;
Type TestRec = Array[1..512] Of Byte;
Var X : Integer;
TestBuf : TestRec;
I : Integer;
OutFile : File Of TestRec;
DoExit : Boolean;
LoopCounter : LongInt;
Procedure OutputError;
Begin
Assign (OutFile, 'Error.Dat');
ReWrite (OutFile);
Write (OutFile, TestBuf);
Close (OutFile);
End;
Begin
DoExit := False;
LoopCounter := 0;
ClrScr;
TextColor(LightGreen);
Write('TESTR ');
TextColor(White);
HighVideo;
Write('Reading TEST.DAT, checking for errors. Press ALT to Quit');
LowVideo;
Window(1,2,80,25);
While (Mem[$40:$17] AND byte($08) = 0) And (Not DoExit) Do { no ALT or Err }
Begin
FillChar (TestBuf,SizeOf (TestBuf), '.'); { Clear Buffer }
Assign (OutFile, 'TEST.DAT');
FileMode := $40; { Open for Read, Deny none }
Reset (OutFile);
Read (OutFile, TestBuf); { Read record }
Close (OutFile); { Close File }
For I := 2 to 512 Do
If TestBuf[1] <> TestBuf[I] then DoExit := True; { Pattern error }
If Char(TestBuf[1]) = '.' then DoExit := True; { Read Failed, still have '.' }
If DoExit = True then
Begin
Writeln;
Writeln ('Error reading Record ',#7,LoopCounter); { #7 makes Beep }
OutputError;
DoExit := True;
End
Else
Begin
Inc (LoopCounter);
{ If LoopCounter Mod 10 = 0 then } { Uncomment to speed up reads }
WriteLn ('OK ',Char(TestBuf[1]),' ',LoopCounter);
End;
End;
End.